//
//  RBLuckyDrawHistoryCell.m
//  zhongzhenglu
//
//  Created by XL on 2022/8/29.
//

#import "RBLuckyDrawHistoryCell.h"
#import "RBDefine.h"
#import "UIView+RBAdd.h"
#import "UIScrollView+RBAdd.h"
#import "RBSearchTagView.h"
#import "RBThemeConfig.h"
#import <Masonry.h>
#import "RBNavigationBar.h"
#import "RBTextField.h"
#import "UIButton+RBAdd.h"
#import <UIColor+YYAdd.h>
#import <NSDate+YYAdd.h>

@interface RBLuckyDrawHistoryCell()

@property(nonatomic, strong)UILabel *timeL;
@property(nonatomic, strong)UILabel *desL;
@property(nonatomic, strong)UIView *lineView;

@end

@implementation RBLuckyDrawHistoryCell

- (void)setCellModel:(RBCellModel *)cellModel
{
    RBLuckyDrawHistoryModel *model = cellModel.cellData;
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.contentView.backgroundColor = UIColor.clearColor;
    self.backgroundColor = UIColor.clearColor;
    self.timeL.text = [[NSDate dateWithTimeIntervalSince1970:model.create_time] stringWithFormat:@"yyyy.MM.dd HH:mm"];
    self.desL.text = model.jiang_title;
    self.lineView.hidden = NO;
}

#pragma mark - Getter

- (UILabel *)timeL
{
    if (!_timeL)
    {
        self.timeL = ({
            UILabel *view = [RanTool labelWithFontSize:Zoom(14) weight:0 color:[RBThemeConfig textLightBlackColor] align:0 text:@"2022.3.25  8:24"];
            [self.contentView addSubview:view];
            [view mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.mas_equalTo(Zoom(36));
                make.centerY.mas_equalTo(0);
            }];
            view;
        });
    }
    return _timeL;
}

- (UILabel *)desL
{
    if (!_desL)
    {
        self.desL = ({
            UILabel *view = [RanTool labelWithFontSize:Zoom(14) weight:2 color:[RBThemeConfig textBlackColor] align:0 text:@"获得10元优惠券一张"];
            [self.contentView addSubview:view];
            [view mas_makeConstraints:^(MASConstraintMaker *make) {
                make.right.mas_equalTo(Zoom(-36));
                make.centerY.mas_equalTo(0);
            }];
            view;
        });
    }
    return _desL;
}

- (UIView *)lineView
{
    if (!_lineView)
    {
        self.lineView = ({
            UIView *view = UIView.new;
            view.backgroundColor = [UIColor colorWithHexString:@"#DCDCDC"];
            [self.contentView addSubview:view];
            [view mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.right.bottom.mas_equalTo(0);
                make.height.mas_equalTo(1);
            }];
            view;
        });
    }
    return _lineView;
}

@end
